package thread;

import static java.lang.Thread.sleep;

class Mythread2 extends Thread {
    @Override
    public void run() {
        while(true) {
            System.out.println("hello thread");
            try {
                sleep(100);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
public class ThreadDemo2 {
    public static void main(String[] args) {
        Thread thread = new Mythread2();
        thread.start();;
        while(true) {
            System.out.println("hello main");
            try {
                sleep(100);
            }catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
